package com.shotgun.my.fgc.startup.zfntdengine;

import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;
import org.springframework.core.io.ClassPathResource;

import java.util.ArrayList;
import java.util.List;

/***
 * *---------------------------
 * @Description: zfn启动类
 * ***---------------------------
 * @author: wulingming
 * @date: 2024年05月23日 12:01
 * @version: v1.0
 * ****---------------------------
 */
public class StartUpZfnTdengine {


    /**
     * @Description: The entry point of application.
     * @param args the input arguments
     * @throws Exception the exception
     */
    public static void main(String[] args) throws Exception {
        List<String> warnings = new ArrayList<>();

        long curtime = System.currentTimeMillis();
        ClassPathResource generatorConfigResource = new ClassPathResource("config/zfntdengine/generatorConfigTdengine.xml");
        //		File configFile = new File("generatorConfig.xml");
        ConfigurationParser cp = new ConfigurationParser(warnings);
        Configuration config = cp.parseConfiguration(generatorConfigResource.getInputStream());
        DefaultShellCallback callback = new DefaultShellCallback(true);
        MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
        myBatisGenerator.generate(null);

        long curtime2 = System.currentTimeMillis();

        System.out.println(String.join("\n", warnings));
        System.out.println("总耗时(ms)： " + (curtime2 - curtime));
        System.out.println(StartUpZfnTdengine.class.getSimpleName() + "........................end.");

    }
}
